from django.http import JsonResponse
from rest_framework.viewsets import ModelViewSet
from equity_mall.utils.pages import MyPage
from rest_framework.response import Response
from encourage.models import *
from encourage.serializers_encourage import *

class EncourageDataKeguanModelViewSet(ModelViewSet):

    pagination_class = MyPage
    filter_backends = (filters.SearchFilter, DjangoFilterBackend)
    filter_class = EncourageDataKeguanFilter
    search_fields = ('encouragedraw__payment_no',)

    def get_queryset(self):
        queryset = EncourageDrawDataKeguan.objects.all()
        return queryset.order_by('-id')

    def get_serializer_class(self):
        return EncourageKeGuanListModelSerializer

